package com.example.mapper;

import com.example.entity.singerAndGame.Game;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GameMapper {
    @Select("select * from games")
    List<Game> getGameList();

    @Select("select * from games where gid = #{gid}")
    Game getGameByGid(int gid);

    @Insert("insert into games (name, info, start_time, end_time) " +
            "VALUES (#{name}, #{info}, #{start_time}, #{end_time})")
    int addGame(Game game);

    @Update("update games set name = #{name}, info = #{info}," +
            " start_time = #{start_time}, end_time = #{end_time} where gid = #{gid}")
    int updateGame(Game game);

    @Delete("delete from games where gid = #{gid}")
    int deleteGameByGid(int gid);
}
